package com.books.controller.utils;

public class R {
    private Integer code;
    private Object data;
    private String msg;
    private Integer count;

    public R(){}

    public R(int code){
        this.code = code;
    }

    public R(int code,Object data){
        this.code = code;
        this.data = data;
    }
    public R(int code,String msg){
        this.code = code;
        this.msg = msg;
    }

    public R(String msg){
        this.code = 0;
        this.msg = msg;
    }

    public R Success(Object data,Integer count){
        this.code=0;
        this.data = data;
        this.count = count;
        return this;
    }

    public R Failure(){
        this.code=-1;
        return this;
    }



    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public Integer getCount() {
        return count;
    }

    public void setCount(Integer count) {
        this.count = count;
    }
}
